package COM.ZYC;

import javax.tools.ForwardingJavaFileManager;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Demo8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Date date = new Date();
        while (true) {

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd号 HH:mm:ss");

            String currentTime = sdf.format(new Date());

            System.out.println("当前时间：" + currentTime + " 按n退出循环");


            System.out.print("n退出");

            String input = new java.util.Scanner(System.in).nextLine();


            if ("n".equals(input)) {
                System.out.println("退出循环");
                break;
            }
        }
    }
}

